﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;

namespace Machinery.Extensions
{
    public static class SessionExtensions
    {
        /// <summary>
        /// Detects if the Session is operating on the SQLite in-memory database, as
        /// opposed to a real SQL server.
        /// </summary>
        /// <param name="session"></param>
        /// <returns></returns>
        public static bool IsUsingInMemoryDatabase(this ISession session)
        {
            var connectionString = session.Connection.ConnectionString;
            return connectionString.Contains("Data Source=:memory");
        }
    }
}
